<?php
/**
 * Модель module
 * 
 * Класс модели
 * @author Anton Zavidov
 * @package myLiveShop
 */

/**
 * Модель module
 *
 */
class ModelModule extends Model {
	
	const TABLE				= 'module';
	const F_MODULE_ID  	= 'module_id';
	const F_IMAGE_ID  	= 'image_id';
	const F_COST  	= 'cost';
	const F_PAY  	= 'pay';
	const F_NAME  	= 'name';
	const F_SETTINGS  	= 'settings';
	const F_TITLE  	= 'title';
	const F_DESCRIPTION  	= 'description';
	const F_LANG_ID  	= 'lang_id';
			
	public function __construct($className=null){
		parent::__construct(__CLASS__);
		$this->name='module';
		$this->id_field=array(self::F_MODULE_ID);
		$this->fields=array(
		self::TABLE.DOT.self::F_MODULE_ID=> new Field($this,self::F_MODULE_ID,self::TABLE,array(
				'auto'=>true,
				'important'=>true,
				'lenght'=>4)),
		self::TABLE.DOT.self::F_IMAGE_ID=> new Field($this,self::F_IMAGE_ID,self::TABLE,array(
				'lenght'=>11,
				'join_table'=>'image')),
		self::TABLE.DOT.self::F_COST=> new Field($this,self::F_COST,self::TABLE,array(
				'important'=>true,
				'auto'=>true,
				'lenght'=>3)),
		self::TABLE.DOT.self::F_PAY=> new Field($this,self::F_PAY,self::TABLE,array(
				'important'=>true,
				'auto'=>true,
				'lenght'=>3)),
		self::TABLE.DOT.self::F_NAME=> new Field($this,self::F_NAME,self::TABLE,array(
				'important'=>true,
				'lenght'=>30,
				'type'=>Field::TYPE_STRING)),
		self::TABLE.DOT.self::F_SETTINGS=> new Field($this,self::F_SETTINGS,self::TABLE,array(
				'important'=>true,
				'type'=>Field::TYPE_TEXT)),
		self::TABLE.DOT.self::F_TITLE=> new Field($this,self::F_TITLE,self::TABLE,array(
				'important'=>true,
				'lenght'=>255,
				'type'=>Field::TYPE_STRING)),
		self::TABLE.DOT.self::F_DESCRIPTION=> new Field($this,self::F_DESCRIPTION,self::TABLE,array(
				'important'=>true,
				'type'=>Field::TYPE_TEXT)),
		self::TABLE.DOT.self::F_LANG_ID=> new Field($this,self::F_LANG_ID,self::TABLE,array(
				'auto'=>true,
				'lenght'=>2,
				'join_table'=>'lang'))		);
	}
}
